#
# Be sure to run `pod lib lint MediaSDK-iOS.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#

Pod::Spec.new do |s|
    s.name             = 'MediaSDK-iOS'
    s.version          = '0.5.1'
    s.summary          = 'Media SDK For iOS'
    
    # This description is used to generate tags and improve search results.
    #   * Think: What does it do? Why did you write it? What is the focus?
    #   * Try to keep it short, snappy and to the point.
    #   * Write the description between the DESC delimiters below.
    #   * Finally, don't worry about the indent, CocoaPods strips it!
    
    s.description      = 'Media SDK For iOS Can Record And Edit Video/Image'
    
    s.homepage         = 'https://git.work.yunyugz.com/AVMediaSDK/MediaSDK-IOS'
    # s.screenshots     = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
    s.license          = { :type => 'MIT', :file => 'LICENSE' }
    s.author           = { 'huangyq' => 'huangyq@yunyugz.com' }
    s.source           = { :git => 'https://git.work.yunyugz.com/AVMediaSDK/MediaSDK-IOS.git', :tag => s.version.to_s }
    # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
    
    s.ios.deployment_target = '10.0'
    
    s.swift_version = '5.0'
    
    s.default_subspec = 'MediaSDK'
    
#    # 源文件
#    s.source_files = 'MediaSDK-iOS/Classes/**/*.{h,m,mm,swift}'
    
#    # pch文件
#    s.prefix_header_contents = '#import "MediaSDK-Header.h"'
    
    # 资源Bundle
    s.resource_bundles = {
        'MediaSDK-iOS' => ['MediaSDK-iOS/Assets/MediaRecordSDK.xcassets', 'MediaSDK-iOS/Assets/Localizable/**/*', 'MediaSDK-iOS/Assets/Other/**/*.{png,mp3,gif}']
    }
    
    # Pod Target配置
    s.pod_target_xcconfig = {
        # This is needed by all pods that depend on Protobuf:
        'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1',
        # This is needed by all pods that depend on gRPC-RxLibrary:
        'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES',
        # 是否开启Bitcode
        'ENABLE_BITCODE' => 'NO',
        'VALID_ARCHS' => 'x86_64 arm64 arm64e',
        'DEFINES_MODULE' => 'YES'
        # 解决pod lib lint/repo push不支持i386编译，同时使用pod lib lint/repo push  --skip-import-validation
#        'VALID_ARCHS[sdk=iphonesimulator*]' => ''
    }
    
    s.subspec 'MediaSDKCore' do |core|
        core.source_files = 'MediaSDK-iOS/Classes/MediaSDKCore/**/*.{h,m,mm}'
        # 需要暴露出去的头文件
        core.public_header_files = 'MediaSDK-iOS/Classes/MediaSDKCore/**/*.h'
        core.frameworks = 'VideoToolbox', 'CoreMedia'
        # 手动引进来的第三方Framework
        core.vendored_frameworks = 'MediaSDK-iOS/Classes/MediaSDKCore/Lib/mobile-ffmpeg-framework/*.framework'
        # 手动引进来的第三方.a文件
        core.vendored_libraries = 'MediaSDK-iOS/Classes/MediaSDKCore/Lib/ltFFmpeg/lib/*.a'
        # 忽略的文件夹路径
        core.exclude_files = 'MediaSDK-iOS/Classes/MediaSDKCore/Lib/**/*.h'
        # 依赖的系统库
        core.libraries = 'c++', 'z', 'iconv'
        core.pod_target_xcconfig = {
          # .a库的头文件引用路径
#          'USER_HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/../../MediaSDK-iOS/Classes/MediaSDKCore/Lib/ltFFmpeg/include"/**',
          'HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/../../MediaSDK-iOS/Classes/MediaSDKCore/Lib/ltFFmpeg/include"/**'
        }
    end
    
    s.subspec 'MediaSDK' do |mediaSDK|
        mediaSDK.subspec 'Base' do |base|
            base.source_files = 'MediaSDK-iOS/Classes/MediaSDK/Base/**/*.{h,m,swift}'
            base.dependency 'MediaSDK-iOS/MediaSDKCore'
        end

        mediaSDK.subspec 'PhotoEdit' do |photoEdit|
            photoEdit.source_files = 'MediaSDK-iOS/Classes/MediaSDK/PhotoEdit/**/*.{h,m,swift}'
            photoEdit.public_header_files = 'MediaSDK-iOS/Classes/MediaSDK/PhotoEdit/*.h'
            photoEdit.dependency 'MediaSDK-iOS/MediaSDK/Base'
        end

        mediaSDK.subspec 'VideoEdit' do |videoEdit|
            videoEdit.source_files = 'MediaSDK-iOS/Classes/MediaSDK/VideoEdit/**/*.{h,m,swift}'
            videoEdit.dependency 'MediaSDK-iOS/MediaSDK/Base'
        end

        mediaSDK.subspec 'Camera' do |camera|
            camera.source_files = 'MediaSDK-iOS/Classes/MediaSDK/Camera/**/*.{h,m,swift}'
            camera.dependency 'MediaSDK-iOS/MediaSDK/Base'
        end
    end
    
    # 依赖第三方Pod库
    s.dependency 'SVGAPlayer'
    s.dependency 'GPUImage'
    s.dependency 'SnapKit'
    s.dependency 'TYPagerController'
    s.dependency 'SDWebImage'
    s.dependency 'MJRefresh', '~> 3.3.1'
    s.dependency 'KTVHTTPCache'
    s.dependency 'MBProgressHUD'
end
